import axios from '../utils'

//公开接口API
const api = {
    getCountries: '/overt/getCountries',
    getTelephoneCode: '/overt/getTelephoneCode',
    getIabCategories: '/pulldown-data/getIabCategories',
    getExchangeList: '/pulldown-data/getExchangeRtbspecs',
    getExchanges: '/pulldown-data/getExchanges',

    getTermsOfUseAPI: '/overt/getTermsOfUse', //获取使用条款HTML
    getPrivacyPolicyAPI: '/overt/getPrivacyPolicy', //获得隐私政策

    changeTermsOfUseAPI: '/company/changeTermsOfUse',  //修改存款发票
    changePrivacyPolicyAPI: '/company/changePrivacyPolicy',  //修改隐私政策
    getCampaignsListAPI: '/pulldown-data/getCampaignsList', //查询所有广告/广告系列

    etBindUserAPI: '/pulldown-data/getBindUser' //获取用户绑定的ssp
}

export default api

export function getBindUser() {
    return axios.get(api.etBindUserAPI)
}

export function getCountries() {
    return axios({
        url: api.getCountries,
        method: 'get'
    })
}

export function getTelephoneCode() {
    return axios({
        url: api.getTelephoneCode,
        method: 'get'
    })
}

export function getIabCategories() {
    return axios({
        url: api.getIabCategories,
        method: 'get'
    })
}
//查询自定义规则下拉列表
export function getExchangeList(parameter) {
    return axios({
        url: api.getExchangeList,
        method: 'get',
        params: parameter
    })
}

//查询交易所下拉列表
export function getExchanges(parameter) {
    return axios({
        url: api.getExchanges,
        method: 'get',
        params: parameter
    })
}

export function getTermsOfUse() {
    return axios.get(api.getTermsOfUseAPI)
}

export function getPrivacyPolicy() {
    return axios.get(api.getPrivacyPolicyAPI)
}

export function changeTermsOfUse(termsOfUse) {
    return axios.put(api.changeTermsOfUseAPI, {
        termsOfUse
    })
}

export function changePrivacyPolicy(privacyPolicy) {
    return axios.put(api.changePrivacyPolicyAPI, {
        privacyPolicy
    })
}
export function getCampaignsList(type) {
    return axios.get(api.getCampaignsListAPI, {
        params: {
            type
        }
    })
}
